<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <h2>你好</h2>
  <div id="container"></div>
  <script type="text/template" id="template01">
  <div class='list'>
    <ol>
      {{#students}}
      <li>
        学生{{name}}的爱好是
        <ol>
          {{#hobbies}}
          <li>{{.}}</li>
          {{/hobbies}}
        </ol>
      </li>
      {{/students}}
    </ol>
  </div>
  </script>
  <script src="/xuni/bundle.js"></script>
  <script>
    let templateStr = document.getElementById('template01').innerHTML
        let data = {
          students: [
            { name: '小明', hobbies: ['足球', '篮球'] },
            { name: '小红', hobbies: ['游泳', '跑步'] },
            { name: '小强', hobbies: ['睡觉', '游戏'] },
          ]
        }

        let domstr = TemplateEngine.render(templateStr, data);
        let container = document.getElementById('container')
        container.innerHTML = domstr
  </script>
</body>

</html>